//
//  ReadSecDetailTableViewCell.m
//  LuckyRadio
//
//  Created by Mr、J on 15/11/12.
//  Copyright © 2015年 chenjun. All rights reserved.
//

#import "ReadSecDetailTableViewCell.h"
@implementation ReadSecDetailTableViewCell

-(void)dealloc
{
    [_titleLable release];
    [_leftImg release];
    [_rightLable release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    //全部专题的cell
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.leftImg = [[UIImageView alloc]init];
        self.titleLable= [[UILabel alloc]init];
        self.rightLable = [[UILabel alloc]init];
        
        [self.contentView addSubview:self.leftImg];
        [self.contentView addSubview:self.titleLable];
        [self.contentView addSubview:self.rightLable];
        
        [_leftImg release];
        [_titleLable release];
        [_rightLable release];
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.titleLable.frame = CGRectMake(10, 10, self.frame.size.width - 20, 40);
    self.leftImg.frame = CGRectMake(10, 60, (self.frame.size.width - 20) / 2, 80);
    self.rightLable.frame = CGRectMake(10 + (self.frame.size.width - 20) / 2 + 5, 60, (self.frame.size.width - 20) / 2 - 10, 80);
    
}
-(void)setModel:(ReadSecDetailModel *)model{
    if (_model != model) {
        [_model release];
        [_model retain];
    }
    self.titleLable.text = model.title;
    self.titleLable.font = [UIFont systemFontOfSize:20 weight:8];
    self.rightLable.text = model.content;
    self.rightLable.numberOfLines = 0;
    [self.leftImg sd_setImageWithURL:[NSURL URLWithString:model.coverimg] placeholderImage:[UIImage imageNamed:@"Read_zhanwei"]];
}
+(ReadSecDetailTableViewCell *)readSecDetailTableViewCellWithTableView:(UITableView *)tableView
{
    static NSString * cellIden = @"cellIden";
    ReadSecDetailTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIden];
    if (!cell) {
        cell = [[ReadSecDetailTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIden];
    }
    return cell;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
